Multibody Gravity Simulation
This simulation involved creating 30,000 objects called "asteroids" in a 2-D plane to simulate their dynamics by gravitational attraction. The animation created depicts a rough approximation of what a timelapsed view of an asteroid particle cloud would look like. For this simulation, the objects are set to bounce off the walls of the display window and are void of all collisions between themselves in order to conserve the total energy of the system. In doing so, the energy conservation allows the initial starting conditions to create a potential field which causes the particles to gain kinetic energy and eventually be converted into angular momentum by the entire self-revolving system.
The motion of each asteroid is determined using constructor functions for a class of asteroid objects in a Java environment as this language handles object-oriented programming well. Processing IDE is used for all graphical displays. The gravitational force and dynamics are determined using a vector sum of the remaining asteroids and determining the change in position each frame via Euler's method. The net result of the gravitational force and subsequent motion creates a frame of the video below at each small time step. A color temperature gradient is also applied to cause the slower moving asteroids to appear lighter and the faster moving asteroids to appear yellow. A link to the project source code creating the animation shown below can be found here.
